home *** CD-ROM | disk | FTP | other *** search
/ Windows Expert / Windows Expert.iso / utility / uwserver.zip / uwserver.tar / lib / uw_cmd.c < prev    next >
C/C++ Source or Header  |  1991-01-25  |  799b  |  35 lines

  1. /*
  2.  *    uw library - uw_cmd
  3.  *
  4.  * Copyright 1986 by John D. Bruner.  All rights reserved.  Permission to
  5.  * copy this program is given provided that the copy is not sold and that
  6.  * this copyright notice is included.
  7.  */
  8.  
  9. #include "uwlib.h"
  10.  
  11. uwid_t
  12. uw_cmd(wtype, file, argv)
  13. uwtype_t wtype;
  14. char *file;
  15. char **argv;
  16. {
  17.     register uwid_t uwid;
  18.  
  19.     /*
  20.      * Create a new window (using uw_fork()) and run the specified
  21.      * command in it.  Returns the window ID of the new window
  22.      * (or -1 if the window creation failed).  There is no way to
  23.      * determine if the executed command failed (e.g. if the
  24.      * executable file did not exist).
  25.      */
  26.     if ((uwid = uw_fork(wtype, (int *)0)) == 0) {
  27.         (void)execvp(file, argv);
  28.         uwerrno = UWE_ERRNO;
  29.         perror(file);
  30.         _exit(1);
  31.         /*NOTREACHED*/
  32.     } else
  33.         return(uwid);
  34. }
  35.